﻿using System;
using System.Collections;
using System.Collections.Generic;

namespace NetTopologySuite.Utilities
{
	public static class Caster
	{
		public static IEnumerable<T> Cast<T>(IEnumerable inputs)
		{
			foreach (object obj in inputs)
			{
				yield return (T)((object)obj);
			}
			IEnumerator enumerator = null;
			yield break;
			yield break;
		}

		public static IEnumerable<TSuper> Upcast<TSub, TSuper>(IEnumerable<TSub> inputs) where TSub : TSuper
		{
			foreach (TSub tsub in inputs)
			{
				yield return (TSuper)((object)tsub);
			}
			IEnumerator<TSub> enumerator = null;
			yield break;
			yield break;
		}

		public static IEnumerable<TSub> Downcast<TSuper, TSub>(IEnumerable<TSuper> inputs) where TSub : TSuper
		{
			foreach (TSuper tsuper in inputs)
			{
				yield return (TSub)((object)tsuper);
			}
			IEnumerator<TSuper> enumerator = null;
			yield break;
			yield break;
		}
	}
}
